Skip to content

Comments

feat(#17): 채팅 WS 기본 구성 및 테스트 추가#19

Merged
1000hyehyang merged 5 commits intodevfrom
feat/17-chat
Jan 19, 2026
Merged

feat(#17): 채팅 WS 기본 구성 및 테스트 추가#19
1000hyehyang merged 5 commits intodevfrom
feat/17-chat

Conversation

@1000hyehyang
Copy link
Member

작업 개요

채팅 WebSocket(STOMP) 기본 구성과 샘플 컨트롤러/DTO를 추가하고,
WS 테스트를 ACK/브로드캐스트로 분리해 검증 범위를 명확히 했습니다.
프론트엔드 개발팀을 위해 WS 흐름 문서를 함께 API 명세서에 적어두었습니다.

변경 사항

  • WS 설정 추가(/ws/chat, /app, /topic, /queue, /user)
  • WS 샘플 컨트롤러/DTO/fixture 구성
  • WS 테스트 분리(ACK 수신 / 브로드캐스트 수신)
  • 이미지/파일 메시지 브로드캐스트 테스트 케이스 추가
  • 보안 설정에 채팅 API 접근 허용 범위 추가 (인증 인가 완료되면 다시 설정할 것!!)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @1000hyehyang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 채팅 기능을 위한 WebSocket (STOMP)의 기본 구성을 도입하고, 샘플 컨트롤러, DTO 및 테스트를 추가합니다. 이는 프론트엔드 개발팀이 채팅 기능을 쉽게 통합하고 검증할 수 있도록 지원하며, WebSocket 통신의 핵심 흐름을 명확히 합니다.

Highlights

  • WebSocket 의존성 추가: 채팅 기능 구현을 위해 spring-boot-starter-websocket 의존성을 build.gradle에 추가했습니다.
  • 채팅 WebSocket (STOMP) 기본 구성: WebSocket 엔드포인트 (/ws/chat) 및 메시지 브로커 (애플리케이션 대상 /app, 사용자 대상 /user, 심플 브로커 /topic, /queue)를 설정하는 ChatWebSocketConfig 클래스를 추가했습니다.
  • 샘플 채팅 컨트롤러 및 DTO 구현: /app/chat.send 메시지를 처리하고, ACK를 /user/queue/chat.ack로 전송하며, 메시지를 /topic/rooms/{roomId}로 브로드캐스트하는 ChatSocketController와 관련 DTO (Command, Event, Ack)를 추가했습니다.
  • 샘플 데이터 Fixture Factory 추가: 테스트 및 개발 편의를 위해 샘플 채팅 메시지 이벤트 및 ACK 객체를 생성하는 ChatSocketFixtureFactory를 구현했습니다.
  • 보안 설정 업데이트: WebSocket 경로 (/ws/**)에 대한 접근을 허용하도록 SecurityConfig를 업데이트했습니다.
  • WebSocket 통합 테스트 추가: WebSocket 연결, 메시지 전송 후 ACK 수신, 그리고 텍스트, 이미지, 파일 메시지 브로드캐스트 수신을 검증하는 통합 테스트 케이스를 추가하여 WebSocket 기능의 기본 동작을 확인합니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

채팅 기능의 기반이 되는 WebSocket 기본 구성을 추가하고, 테스트 코드를 통해 동작을 명확히 검증한 점이 좋습니다. 특히 ACK 수신과 브로드캐스트 수신 테스트를 분리하여 각 흐름을 명확하게 확인할 수 있도록 구성한 점이 인상적입니다.

다만, 몇 가지 개선이 필요한 부분이 있어 리뷰를 남깁니다. 가장 중요한 점은 실제 로직이 들어가야 할 컨트롤러에서 테스트용 Fixture를 사용하고 있다는 것입니다. 이는 샘플 구현이라고 하더라도 프로덕션 코드에 포함되어서는 안 되는 방식이므로 반드시 수정이 필요합니다. 또한, 임시로 허용한 WebSocket 엔드포인트의 보안 설정은 큰 위험을 초래할 수 있으므로 빠른 시일 내에 인증/인가 로직을 적용해야 합니다. 이 작업을 추적하기 위해 티켓을 생성하는 것을 권장합니다.

자세한 내용은 각 파일에 남긴 코멘트를 참고해주세요.

}

private void waitForSubscriptions() throws InterruptedException {
TimeUnit.MILLISECONDS.sleep(SUBSCRIBE_WAIT_MILLIS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

테스트 코드에서 Thread.sleep()이나 TimeUnit.sleep()을 사용하는 것은 테스트 환경에 따라 실행 시간이 달라져 테스트가 불안정해지는 원인이 될 수 있습니다 (Flaky test). 비동기 코드를 테스트할 때는 Awaitility와 같은 라이브러리를 사용하면 '최대 N초 동안 매 M초 간격으로 특정 조건이 만족될 때까지 기다리는' 것과 같은 더 안정적이고 선언적인 테스트를 작성할 수 있습니다. 당장은 문제가 되지 않을 수 있지만, 향후 더 복잡한 비동기 테스트를 위해 도입을 고려해보시는 것을 추천합니다.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋아 고려해볼게...

@1000hyehyang 1000hyehyang merged commit 79e1a08 into dev Jan 19, 2026
1 check passed
@1000hyehyang 1000hyehyang deleted the feat/17-chat branch January 19, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants